package ch02.ex3_2_1_UsingWhenToDealWithEnumClasses

/**
 * Created by caozp-ytcyc2007 on 2017/5/21.
 */

enum class Color {
    RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET
}

fun getMnemonic(color: Color) =
        when (color) {
            Color.RED -> "Richard"
            Color.ORANGE -> "Of"
            Color.YELLOW -> "York"
            Color.GREEN -> "Gave"
            Color.BLUE -> "Battle"
            Color.INDIGO -> "In"
            Color.VIOLET -> "Vain"
        }


fun main(args: Array<String>) {
    println(getMnemonic(Color.BLUE))
}